package com.mtsmda.jpa.run;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;

import com.mtsmda.jpa.domain.singleTable.NonTeachingStaff;
import com.mtsmda.jpa.domain.singleTable.TeachingStaff;

public class TeachingServiceRun {

	public static void main(String[] args) {
		EntityManager entityManager = Persistence.createEntityManagerFactory(
				"MTSMDA").createEntityManager();
		entityManager.getTransaction().begin();

		TeachingStaff teachingStaff = new TeachingStaff("Ivan",
				"qualification1", "subjectExpertise1");
		TeachingStaff teachingStaff2 = new TeachingStaff("Petr",
				"qualification2", "subjectExpertise2");

		NonTeachingStaff nonTeachingStaff = new NonTeachingStaff("Petru",
				"areaExpertise1");
		NonTeachingStaff nonTeachingStaff2 = new NonTeachingStaff("Ion",
				"areaExpertise2");

		entityManager.persist(teachingStaff);
		entityManager.persist(teachingStaff2);
		entityManager.persist(nonTeachingStaff);
		entityManager.persist(nonTeachingStaff2);

		entityManager.getTransaction().commit();
		entityManager.close();
	}

}